package com.zenghm.recyclerview.decoration;

import android.graphics.Rect;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

public class SpaceItemDecoration extends RecyclerView.ItemDecoration {

    private final int mLeft;
    private final int mTop;
    private final int mRight;
    private final int mBottom;

    public SpaceItemDecoration(int space) {
        this(space, space, space, space);
    }

    public SpaceItemDecoration(int left, int top, int right, int bottom) {
        mLeft = left;
        mTop = top;
        mRight = right;
        mBottom = bottom;
    }

    @Override
    public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
        outRect.set(mLeft, mTop, mRight, mBottom);
    }
}
